package com.jtpay.sdk.app;

import android.content.Context;
import android.support.multidex.MultiDex;

import com.tencent.bugly.Bugly;
import com.tencent.bugly.beta.Beta;
import com.tencent.tinker.loader.app.TinkerApplication;
import com.tencent.tinker.loader.shareutil.ShareConstants;

import appUtils.PayTokenException;

/**
 * Created by Steven on 2016/6/21 0021.
 * update by Joe
 * add greenDao DataBase operation
 */

public class PayChannelApplication extends TinkerApplication {
    private static final String APP_ID = "4e34dd7d4e";

    public PayChannelApplication() {
        super(ShareConstants.TINKER_ENABLE_ALL, "com.jtpay.sdk.bugly.BuglyApplicationLike",
                "com.tencent.tinker.loader.TinkerLoader", false);
    }

    public static PayChannelApplication getInstance() {
        return Holder.mInstance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        init();

    }

    private void init() {
        Bugly.init(this, APP_ID, false);
        /*CrashHandler handler = CrashHandler.getInstance();
        handler.init(getApplicationContext());*/
        PayTokenException.getInstance().init(this);
    }

    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        // you must install multiDex whatever tinker is installed!
        MultiDex.install(base);
        // 安装tinker
        Beta.installTinker();
    }

    private static class Holder {
        static PayChannelApplication mInstance = new PayChannelApplication();
    }


}
